import {Component, OnInit, Input} from '@angular/core';
// import * as Highcharts from 'highcharts';

import {NavController, ActionSheetController, AlertController, NavParams} from 'ionic-angular';
import {DomSanitizer} from '@angular/platform-browser';
import _ from "lodash";
import {Common} from "../../../../providers/common";
import {IrpQjtPersonService} from "./person.service";
import {IrpQjtpersonDetailService} from "./personDetail.service";

@Component({
  selector: "page-irp-panoramagram-personDetail",
  templateUrl: 'personDetail.html',
  providers: [IrpQjtpersonDetailService]
})
export class IrpQjtpersonDetailPage {
  title;
  item;
  groupIndex;
  datasList=[];
  constructor(public navCtrl: NavController,
              public alertCtrl: AlertController,
              public personDetailService: IrpQjtpersonDetailService,
              public common: Common,
              public navParams: NavParams) {
    this.item=this.navParams.get("item");
    this.groupIndex = this.navParams.get("groupIndex");
    this.setData();
  }
  setData(){
    switch (this.groupIndex){
      case 0:
        this.title="最新研究报告";
        this.datasList=[{title:"标题",value:""},{title:"报告分类",value:""},{title:"证券名称",value:""},{title:"所属行业",value:""},{title:"评级",value:""},
          {title:"作者",value:""},{title:"得分",value:""},{title:"状态",value:""},{title:"撰写时间",value:""}];
        _.forEach(this.datasList,(data,index:number)=>{
          switch (index){
            case 0:
              this.datasList[index].value=this.item.title;
              break;
            case 1:
              this.datasList[index].value=this.item.reporttypename;
              break;
            case 2:
              this.datasList[index].value=this.item.scodeinfo;
              break;
            case 3:
              // this.datasList[index].value=this.item.title;
              break;
            case 4:
              // this.datasList[index].value=this.item.title;
              break;
            case 5:
              this.datasList[index].value=this.item.authornames;
              break;
            case 6:
              this.datasList[index].value=this.item.ratingvalue;
              break;
            case 7:
              this.datasList[index].value=this.item.status;
              break;
            case 8:
              this.datasList[index].value=this.item.archivetime;
              break;
          }
        })
        break;
      case 1:
        this.title="最新股票研究报告排名";
        this.datasList=[{title:"股票代码",value:""},{title:"股票名称",value:""},{title:"报告次数",value:""}];
        _.forEach(this.datasList,(data,index:number)=>{
          switch (index){
            case 0:
              this.datasList[index].value=this.item.scode;
              break;
            case 1:
              this.datasList[index].value=this.item.sname;
              break;
            case 2:
              this.datasList[index].value=this.item.reportnumbers;
              break;
            default:
          }
        });
        break;
      case 2:
        this.title="最近出差";
        this.datasList=[{title:"标题",value:""},{title:"申请时间",value:""},{title:"开始日期",value:""},{title:"结束日期",value:""},
          {title:"报告",value:""}];
        _.forEach(this.datasList,(data,index:number)=>{
          switch (index){
            case 0:
              // this.datasList[index].value=this.item.title;
              break;
            case 1:
              // this.datasList[index].value=this.item.reporttypename;
              break;
            case 2:
              // this.datasList[index].value=this.item.scodeinfo;
              break;
            case 3:
              // this.datasList[index].value=this.item.title;
              break;
            case 4:
              // this.datasList[index].value=this.item.title;
              break;
            default:
          }
        });
        break;
      case 3:
        this.title="最近策略推荐";
        this.datasList=[{title:"推荐日期",value:""},{title:"股票代码",value:""},{title:"股票名称",value:""},{title:"所属行业",value:""},{title:"收盘日期",value:""},
          {title:"股价",value:""},{title:"总市值（亿）",value:""},{title:"相关报告",value:""}];
        _.forEach(this.datasList,(data,index:number)=>{
          switch (index){
            case 0:
              this.datasList[index].value=this.item.recommenddate;
              break;
            case 1:
              this.datasList[index].value=this.item.scode;
              break;
            case 2:
              this.datasList[index].value=this.item.sname;
              break;
            case 3:
              this.datasList[index].value=this.item.industry;
              break;
            case 4:
              this.datasList[index].value=this.item.closedate;
              break;
            case 5:
              this.datasList[index].value=this.item.price;
              break;
            case 6:
              this.datasList[index].value=this.item.totalshares;
              break;
            case 7:
              this.datasList[index].value=this.item.remark;
              break;
            case 8:
              this.datasList[index].value=this.item.archivetime;
              break;
          }
        });
        break;
      case 4:
        this.title="最近金股推荐";
        this.datasList=[{title:"推荐日期",value:""},{title:"股票代码",value:""},{title:"股票名称",value:""},{title:"推荐日五日均价",value:""},{title:"计算日期",value:""},
          {title:"计算日五日均价",value:""},{title:"结束日期",value:""},{title:"结束日五日均价",value:""},{title:"收益率",value:""},{title:"推荐日持仓（万股）",value:""},{title:"当前持仓（万股）",value:""}];
        _.forEach(this.datasList,(data,index:number)=>{
          switch (index){
            case 0:
              this.datasList[index].value=this.item.recommendtime;
              break;
            case 1:
              this.datasList[index].value=this.item.scode;
              break;
            case 2:
              this.datasList[index].value=this.item.sname;
              break;
            case 3:
              this.datasList[index].value=this.item.beginprice;
              break;
            case 4:
              this.datasList[index].value=this.item.startdate;
              break;
            case 5:
              // this.datasList[index].value=this.item.authornames;
              break;
            case 6:
              this.datasList[index].value=this.item.enddate;
              break;
            case 7:
              this.datasList[index].value=this.item.endprice;
              break;
            case 8:
              this.datasList[index].value=this.item.yieldrate;
              break;
            case 9:
              // this.datasList[index].value=this.item.endprice;
              break;
            case 10:
              // this.datasList[index].value=this.item.yieldrate;
              break;
          }
        });
        break;
      case 5:
        this.title="最新晨会股票推荐";
        this.datasList=[{title:"推荐日期",value:""},{title:"股票代码",value:""},{title:"股票名称",value:""},{title:"评级",value:""},{title:"持仓",value:""},
          {title:"历史推荐记录",value:""},{title:"推荐日至今涨跌幅",value:""},{title:"相关报告",value:""}];
        _.forEach(this.datasList,(data,index:number)=>{
          switch (index){
            case 0:
              this.datasList[index].value=this.item.commentdate;
              break;
            case 1:
              this.datasList[index].value=this.item.scode;
              break;
            case 2:
              this.datasList[index].value=this.item.sname;
              break;
            case 3:
              this.datasList[index].value=this.item.investrank;
              break;
            case 4:
              this.datasList[index].value=this.item.position;
              break;
            case 5:
              this.datasList[index].value=this.item.numbers;
              break;
            case 6:
              // this.datasList[index].value=this.item.ratingvalue;
              break;
            case 7:
              // this.datasList[index].value=this.item.status;
              break;
            default:
          }
        });
        break;
      case 6:
        this.title="最新股票池调整";
        this.datasList=[{title:"调整日期",value:""},{title:"股票代码",value:""},{title:"股票名称",value:""},{title:"最新评级",value:""},{title:"上级评级",value:""},
          {title:"调整方向",value:""},{title:"股票池",value:""}];
        _.forEach(this.datasList,(data,index:number)=>{
          switch (index){
            case 0:
              this.datasList[index].value=this.item.submittime;
              break;
            case 1:
              this.datasList[index].value=this.item.scode;
              break;
            case 2:
              this.datasList[index].value=this.item.sname;
              break;
            case 3:
              // this.datasList[index].value=this.item.title;
              break;
            case 4:
              // this.datasList[index].value=this.item.title;
              break;
            case 5:
              this.datasList[index].value=this.item.adjustmode;
              break;
            case 6:
              this.datasList[index].value=this.item.poolid;
              break;
            default:
          }
        });
        break;

    }
  }
}

